Current Location: Home> Function Categories> date_offset_get

date_offset_get

Alias ​​for DateTime::getOffset - Returns the time zone offset
Name:date_offset_get
Category:Date and time
Programming Language:php
One-line Description:Returns the time zone offset.

Definition and usage

date_offset_get() function returns the time zone offset.

Example

Returns the time zone offset in seconds for winter and summer in New York relative to UTC:

 <?php
$winter = date_create ( "2016-10-15" , timezone_open ( "America/New_York" ) ) ;
$summer = date_create ( "2016-01-28" , timezone_open ( "America/New_York" ) ) ;

echo date_offset_get ( $winter ) . " seconds.<br />" ;
echo date_offset_get ( $summer ) . " Second." ;
?>

Try it yourself

grammar

 date_offset_get ( object ) ;
parameter describe
object Required. Specifies the DateTime object returned by date_create() .
Similar Functions
Popular Articles